﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Automobile
{
    class CPool
    {
        /*private List<Sedan> scar;
        private List<Coupe> ccar;
        private List<Mini> mcar;*/
        private List<Cars> car;

        public CPool()
        {
            car = new List<Cars>();
            //ccar = new List<Coupe>();
           // mcar = new List<Mini>();
            
        }
        
        public  void Add1(Cars c)
        {
            if (!car.Contains(c))
            car.Add(c);
        }

        public  void Remove1(Cars c)
        {
            if (car.Contains(c))
            car.Remove(c);
        }

        public Cars Exist(string nume, string culoare, string transmisie, string caracteristica)
        {  
            Cars masina=null;
            if (nume.CompareTo("Sedan") == 0)
            {
                masina = new Sedan(nume, culoare, transmisie, caracteristica);
                             
            } 
            else
            if (nume.CompareTo("Coupe") == 0)
            {
                masina = new Coupe(nume, culoare, transmisie, caracteristica);
               
            } 
            else
            if (nume.CompareTo("Mini") == 0)
            {
                masina = new Mini(nume, culoare, transmisie, caracteristica);
            }

            return masina;

            
        }

     



    }
}
